<script>
  var a = 0
  function increase(a){
	  return (parseFloat(a))?(a+1):1;
  }
	  
  function timedCount()
  {
    
    chrome.tabs.getSelected(null, function(tab) 
    {
        
        if(tab.url.substr(0,24) == "http://www.facebook.com/" || tab.url.substr(0,25) == "https://www.facebook.com/")
        {
			// FACEBOOK
			a = parseInt(localStorage.getItem('socialCounter_facebook'))
			a = increase(a)
            localStorage.setItem('socialCounter_facebook',a)
        }
		else if(tab.url.substr(0, 24) == "https://plus.google.com/")
		{
			// PLUS
			a = parseInt(localStorage.getItem('socialCounter_plus'))
			a = increase(a)
            localStorage.setItem('socialCounter_plus',a)
		}
		else if(tab.url.substr(0, 19) == "http://twitter.com/")
		{
			// TWITTER
			a = parseInt(localStorage.getItem('socialCounter_twitter'))
			a = increase(a)
            localStorage.setItem('socialCounter_twitter',a)
		}
    });
    
    setTimeout("timedCount()",1000);  
    
  } 
   
  setTimeout("timedCount()",1000);      
  
</script>
